package run.theo.mallorder.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import run.theo.mallcommons.entity.Product;
import run.theo.mallorder.feign.fallback.ProductsProviderFallback;

/**
 * project name: IntelliJ IDEA
 * Date: 2022/10/17 15:33
 *
 * @PackageName: run.theo.mallorder.service
 * @ClassName: ProductsProvider
 * @Author: Theo
 * @Version:
 * @Description:
 */
@FeignClient(
        name = "mall-products",
//        fallback = ProductsProviderFallback.class
        fallbackFactory = ProductsProviderFallback.class
) //value，name指定调用哪个nacos下的微服务.fallback用于指定当前feign接口的容错类
public interface ProductsProvider {
    @GetMapping("/product/{pid}")
    Product findByPid(@PathVariable("pid") Integer pid);
}
